<template>
	<el-container>
		<el-header style="font-size: 16px;font-weight: 600">招标权限设置</el-header>
		<el-main class="nopadding">
			<el-main>
				<el-form>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="审批权限" label-width="150px">
								<select-user-dialog v-model:accountId="form.approveRole" :mode="true"/>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;">招标项目审批人。</span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="查询人员" label-width="150px">
								<select-user-dialog v-model:accountId="form.queryUserRole" :mode="true"/>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;">可查询招标信息的人员。</span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="查询部门" label-width="150px">
								<select-dept-dialog v-model:deptId="form.queryDeptRole" :mode="true"/>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;">可查询招标信息的部门。</span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="查询职务" label-width="150px">
								<select-user-level-dialog v-model:levelId="form.queryLevelRole" :mode="true"/>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;">可查询招标信息的职务。</span>
							</el-form-item>
						</el-col>
					</el-row>
				</el-form>
			</el-main>
		</el-main>
		<el-footer class="footer">
			<el-button type="primary" @click="setInviteRole">设置</el-button>
		</el-footer>
	</el-container>
</template>

<script>
import selectUserDialog from "@/views/module/selectUserDialog.vue";
import selectDeptDialog from "@/views/module/selectDeptDialog.vue";
import selectUserLevelDialog from "@/views/module/selectUserLevelDialog.vue";

export default {
	name: 'Invite Role',
	components: {selectUserLevelDialog, selectDeptDialog, selectUserDialog},
	data() {
		return {
			form: {
				approveRole:'',
				queryUserRole:'',
				queryDeptRole:'',
				queryLevelRole:''
			},
		}
	},
	mounted() {
		this.getInviteRole();
	},
	methods: {
		async setInviteRole() {
			var res = await this.$API.invite.inviteRole.setInviteRole.post(this.form);
			if (res.code == 200) {
				this.$message.success(res.message)
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getInviteRole() {
			var res = await this.$API.invite.inviteRole.getInviteRole.get();
			if (res.code == 200) {
				this.form = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style scoped>
.footer {
	text-align: center;
}
</style>
